package main

import (
	"fmt"
)

type cat struct {
	name string
}

func (c cat) speak() {
	fmt.Println(c.name, "在叫，喵喵喵")
}

type dog struct {
	name string
}

func (d dog) speak() {
	fmt.Println(d.name, "在叫，汪汪汪")
}

type talker interface {
	speak()
}

func beat(x talker) {
	x.speak()
}

func main() {
	fmt.Println("hello, world!")

	c := cat{
		name: "小猫咪",
	}

	d := dog{
		name: "小狗狗",
	}

	beat(c)
	beat(d)
}
